#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2018-04-17 08:12:46
# @Author  : Your Name (you@example.org)
# @Link    : link
# @Version : 1.0.0

from django.conf.urls import url
from django.contrib import admin
from . import views

app_name = 'polls'
admin.site.site_header = "投票系统"
class IpAdminForbitMiddleWare(object):
    def process_request(self, request):
        if request.META.has_key('HTTP_X_FORWARDED_FOR'):  
            ip =  request.META['HTTP_X_FORWARDED_FOR']  
        else:  
            ip = request.META['REMOTE_ADDR']  
        if not ip.startswith('10.') :
            rasie("PermissionForbidden")


urlpatterns = [
    url(r'^$',views.index, name='index'),
    # ex: /polls/5/
    url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
    # ex: /polls/5/results/
    url(r'^(?P<question_id>[0-9]+)/results/$', views.results, name='results'),
    # ex: /polls/5/vote/
    url(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, name='vote'),
    # url(r'^specifics/(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
]